import request from '@/utils/request'
// 引入数据类型
import type {trademarkResponseData,trademark} from '@/api/product/trademark/model/trademark'

// 枚举地址
enum API{
    TRADEMARKLIST = '/admin/product/baseTrademark/',//获取全部品牌
    ADDTRADEMARK = '/admin/product/baseTrademark/save',
    UPDATETRADEMARK = '/admin/product/baseTrademark/update',
    DELETETRADEMARK='/admin/product/baseTrademark/remove/'
}

// 获取品牌数据的接口
export const reqTradeMarkList = (page:number,limit:number)=>request.get<any,trademarkResponseData>(API. TRADEMARKLIST + `${page}/${limit}`)

// 添加新的品牌与修改已有的品牌数据
export const reqAddOrUpdateTradeMark=(data:trademark)=>{
     if(data.id){
        // 修改数据
        return request.put<any,any>(API.UPDATETRADEMARK,data)
     }else{
        // 新增数据
        return request.post<any,any>(API.ADDTRADEMARK,data)
     }
}

// 删除品牌接口
export const  reqDeleteTradeMark =(id:number)=>request.delete<any,any>(API.DELETETRADEMARK+id);